#pragma once

#include "Defines.h"
#include "Animation.h"
#include <string>
#include "Visual.h"

enum EntityType {
	TYPE_BUILDING,
	TYPE_UNIT,
	TYPE_NONE,
};

class Entity
{
public:
	Entity();
	Entity(const std::string& filename);
	~Entity();

	virtual void Update(uint16 diff);
	inline Animation* GetAnimation() { return &m_animation; }
	virtual bool Load(const std::string& filename);

	inline const sf::Vector2f& GetPos()  const { return pos; }
	inline const sf::Vector2f& GetSize() const { return size; }
	inline Rect GetRect() const { return Rect(pos,size); }

	inline float x() const { return pos.x; }
	inline float y() const { return pos.y; }
	inline float w() const { return size.x;}
	inline float h() const { return size.y;}

	inline void SetPos(float x, float y) { pos.x = x; pos.y = y; }
	inline void SetPos(const sf::Vector2f& position) { pos = position; }
	inline void Move(float offsetX, float offsetY) { pos.x += offsetX; pos.y += offsetY; }
	inline void Move(const sf::Vector2f& offset) { pos.x += offset.x; pos.y += offset.y; }

	inline EntityType GetType() const { return m_type; }
	inline bool IsUnit() const { return m_type == TYPE_UNIT; }
	inline bool IsBuilding() const { return m_type == TYPE_BUILDING; }
private:
	Animation m_animation;
	sf::Vector2f pos,size;				//used for collision ?
	sf::Vector2i hotspot;				//internally used.. the isometric hotspot(used for placement)
	VisualPack* m_visual;				//the visualpack id used to represent(draw) the entity
	uint16 m_visualId;					//the guid of the visual pack
	EntityType m_type;					//the type of the entity.. building/unit etc
};

